Skip to content

Improve isolated build UX and fix git worktree serve#3210

Merged
cotti merged 7 commits into
mainfrom
fix/isolated-build-fixes
Apr 30, 2026
Merged

Improve isolated build UX and fix git worktree serve#3210
cotti merged 7 commits into
mainfrom
fix/isolated-build-fixes

Conversation

@Mpdreamz
Copy link
Copy Markdown
Member

Why

The isolated build output had several issues that made it feel rough for developers previewing their own docs repo. The header was styled for the full Elastic docs experience (blue, full nav items like version selector and report-issue link) rather than a lightweight local preview. The sidebar lacked a home/landing link. The `serve` command crashed when run from a git worktree because the scoped filesystem blocked reads from the main repo's `.git` directory.

What

Header: replaced the blue background with a light grey gradient (border + shadow). The GitHub link and deployment-info button now share a muted grey button style (system monospace font, blue on hover) so they look intentional rather than leftover. Logo hover is tightened to match the button vertical rhythm.

Navigation: the index page now surfaces as the first nav item using `navigation_title` from YAML front matter (e.g. "Introduction"). Single-item breadcrumbs are suppressed since they serve no navigation purpose. Breadcrumb vertical padding is reduced. h1 gains top margin.

Sidebar cleanup: version selector, "Report a docs issue", and "Learn how to contribute" are now gated on `PrimaryNavEnabled` so isolated builds don't show Elastic-specific links that don't apply to arbitrary repos.

Bug fixes: the "View as Markdown" link on the root page produced `.md` instead of `/index.md`.

Worktree fix: `FileSystemFactory.RealGitRootForPath` now detects when the repo root contains a git worktree pointer file (`.git` as a file rather than a directory), resolves the main repo's `.git` directory, and adds it as an extra scope root — allowing `GitCheckoutInformation` to read `config` and `HEAD` without a `ScopedFileSystemException`.

Header: light grey gradient with bottom border and shadow, replacing the
blue background. GitHub link and deployment-info buttons share a muted
grey gradient style with blue hover, using the system monospace font stack.
Logo hover uses a subtle dark tint with consistent vertical padding.

Nav: index page now surfaces as the first nav item using navigation_title
from YAML front matter. Single-item breadcrumbs are hidden (no navigation
value). Breadcrumb vertical padding reduced from py-6 to pt-4/pb-2.

Sidebar: version selector, report-a-docs-issue, and learn-how-to-contribute
are now gated on PrimaryNavEnabled so they don't show in isolated builds.

Bug fixes: root page View-as-Markdown URL was .md, now correctly /index.md.
h1 gains mt-6 top margin. FileSystemFactory.RealGitRootForPath adds the main
repo's .git directory to scope roots when running from a git worktree, fixing
ScopedFileSystemException when serving docs from a worktree checkout.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@Mpdreamz Mpdreamz requested a review from a team as a code owner April 29, 2026 12:15
@Mpdreamz Mpdreamz requested a review from cotti April 29, 2026 12:15
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 29, 2026

Warning

Rate limit exceeded

@cotti has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 41 minutes and 30 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 79ce38e0-2be1-4c57-ba96-c4f5bd6084b2

📥 Commits

Reviewing files that changed from the base of the PR and between dbcd054 and 3acbd83.

📒 Files selected for processing (1)
  • src/Elastic.Documentation.Site/Assets/web-components/Header/DeploymentInfo.tsx
📝 Walkthrough

Walkthrough

This pull request adjusts git-root scoping in FileSystemFactory to correctly handle git worktrees by deriving an initial root from WorkingDirectoryRoot when path is null, building an expanded allowed-roots list (including app data), and, if a .git file exists, parsing its gitdir: target to locate and include the main repository’s .git directory. It preserves a fast path that reuses RealRead when no extra worktree scope is needed; otherwise it returns a new ScopedFileSystem. It also updates header and deployment-info UI elements, navigation/templates for TOC/index rendering, markdown root URL generation, and breadcrumb/layout spacing logic.

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant FileSystemFactory
  participant WorkingDirectoryRoot
  participant FileSystem
  Note over FileSystemFactory,WorkingDirectoryRoot: ResolveRealGitRoot(path)
  Caller->>FileSystemFactory: ResolveRealGitRoot(path)
  FileSystemFactory->>WorkingDirectoryRoot: derive initial root (if path == null)
  FileSystemFactory->>FileSystem: collect roots (app data, initial root, path)
  FileSystem->>FileSystem: check for `.git` file at root
  alt `.git` file is a worktree pointer
    FileSystem->>FileSystem: read `gitdir:` target from `.git` file
    FileSystem->>FileSystemFactory: return main repo .git path
    FileSystemFactory->>FileSystemFactory: add main repo .git to allowed roots
  end
  alt path == null and no extra worktree scope added
    FileSystemFactory->>Caller: return existing RealRead (fast path)
  else
    FileSystemFactory->>FileSystem: create ScopedFileSystem with expanded roots
    FileSystem->>Caller: return ScopedFileSystem
  end
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and concisely summarizes the main changes: improving isolated build UX and fixing a git worktree bug.
Description check ✅ Passed The description is directly related to the changeset, detailing the why, what, and how for each category of changes across the PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/isolated-build-fixes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 41 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/Elastic.Documentation.Site/Navigation/_TocTreeNav.cshtml`:
- Around line 9-21: The top-level index item is rendered unconditionally under
the isTopLevel branch, bypassing hidden-item filtering; update the conditional
to also check the index hidden flag (e.g. only render when isTopLevel &&
!Model.SubTree.Index.Hidden — or !Model.SubTree.Index.IsHidden if that property
is used) so the Index (Model.SubTree.Index) link (NavigationTitle with
Htmx.GetNavHxAttributes) is skipped when marked hidden.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: d7ce87d9-7714-4cf9-af9a-01cee44e1caf

📥 Commits

Reviewing files that changed from the base of the PR and between 8bd6f30 and b90634e.

📒 Files selected for processing (9)
  • src/Elastic.Documentation.Configuration/FileSystemFactory.cs
  • src/Elastic.Documentation.Site/Assets/markdown/typography.css
  • src/Elastic.Documentation.Site/Assets/web-components/Header/DeploymentInfo.tsx
  • src/Elastic.Documentation.Site/Assets/web-components/Header/Header.tsx
  • src/Elastic.Documentation.Site/Navigation/_TocTree.cshtml
  • src/Elastic.Documentation.Site/Navigation/_TocTreeNav.cshtml
  • src/Elastic.Markdown/HtmlWriter.cs
  • src/Elastic.Markdown/Layout/_Breadcrumbs.cshtml
  • src/Elastic.Markdown/Layout/_TableOfContents.cshtml

Comment thread src/Elastic.Documentation.Site/Navigation/_TocTreeNav.cshtml Outdated
Mpdreamz and others added 3 commits April 29, 2026 14:36
Index item in nav: only render when not hidden, not in assembler/primary-nav
builds. Breadcrumb single-item suppression scoped to isolated builds only;
breadcrumb py-6 padding restored to match production.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
The mt-6 on h1 compounded the breadcrumb's pb-6, pushing h1 24px lower
than production on assembler builds. Remove mt-6 from h1 and instead add
pt-6 to the content wrapper only when no breadcrumb is visible (isolated
builds with a single-crumb or zero-crumb page). This gives isolated landing
pages breathing room while leaving assembler/multi-crumb pages unchanged.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
The EUI theme types don't expose a `colors.ink` property — `colors.textInk`
is the correct token.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Made-with: Cursor
coderabbitai[bot]
coderabbitai Bot previously requested changes Apr 30, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@src/Elastic.Documentation.Site/Assets/web-components/Header/DeploymentInfo.tsx`:
- Around line 72-77: The popover trigger button in the DeploymentInfo component
lacks an explicit type, which can cause it to submit an enclosing form; update
the JSX button (the element that calls onClick={() => setIsOpen(prev => !prev)}
and uses headerButtonCss(euiTheme)) to include type="button" so it will not act
as a submit button inside forms.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 7922b43a-af5e-4cc9-9162-a22e005bd001

📥 Commits

Reviewing files that changed from the base of the PR and between 345e47c and dbcd054.

📒 Files selected for processing (2)
  • src/Elastic.Documentation.Site/Assets/web-components/Header/DeploymentInfo.tsx
  • src/Elastic.Documentation.Site/Assets/web-components/Header/Header.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/Elastic.Documentation.Site/Assets/web-components/Header/Header.tsx

@cotti
Copy link
Copy Markdown
Contributor

cotti commented Apr 30, 2026

image

Fancy!

@cotti cotti merged commit 546c9e6 into main Apr 30, 2026
24 checks passed
@cotti cotti deleted the fix/isolated-build-fixes branch April 30, 2026 03:46
@cotti cotti mentioned this pull request Jun 3, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants